package com.meiyue.service;

import com.meiyue.bean.entity.TestCitiesEntity;
import com.meiyue.dao.CityDao;
import com.meiyue.library.custom.service.BaseService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * MeiyueJavaProject
 * com.meiyue.service
 * Created by Chris Chen
 * 2017/9/14
 * Explain:城市
 */
@Service
public class CityService extends BaseService<TestCitiesEntity, Integer, CityDao> {
    public boolean addCityList(String cities) {
        String[] cityNames = cities.split(",");
        List<TestCitiesEntity> cityList = new ArrayList<>();
        for (String name : cityNames) {
            cityList.add(new TestCitiesEntity(name));
        }
        return addList(cityList);
    }
}
